#Makefile for NMQJ
BASE=$HOME/tests/nmqj
CC=g++
CFLAGS=-Wall  -std=c++0x -g

LIBS=-L/usr/local/lib -L/usr/lib -L/home/kimmo/C++/ticpp/lib

LFLAGS=-lm -lgsl -lgslcblas -lticpp

INCLS=-I/home/kimmo/Numerics/TNT/include -I/usr/local/include -I../include -I/home/kimmo/C++/ticpp/include

nmqj=$(BASE)/NMQJ
TLA=$(BASE)/tla
LAMBDA=$(BASE)/lambda
LADDER=$(BASE)/ladder


OBJS=dtcl4.o effective_ensemble.o channels.o algorithm.o output.o input.o random.o jumppaths.o rate.o
OTLA=TLA.o
OLAMBDA=Lambda.o
OLADDER=Ladder.o
Onmqj=NMQJ.o


NMQJ:$(OBJS) $(Onmqj)		
	@echo "linking..."
	$(CC) $(CFLAGS) -o $(nmqj) $(OBJS) $(Onmqj) $(LFLAGS) $(LIBS)

tla:$(OBJS) $(OTLA)		
	@echo "linking..."
	$(CC) $(CFLAGS) -o $(TLA) $(OBJS) $(OTLA) $(LFLAGS)

lambda:$(OBJS) $(OLAMBDA)
	@echo "linking..."
	$(CC) $(CFLAGS) -o $(LAMBDA)  $(OBJS) $(OLAMBDA) $(LFLAGS)

ladder:$(OBJS) $(OLADDER)
	@echo "linking..."
	$(CC) $(CFLAGS) -o $(LADDER)  $(OBJS) $(OLADDER) $(LFLAGS) 

SRC=effective_ensemble.cpp initial_state.cpp hamilton.cpp nmqj_alg.cpp rate.cpp random.cpp transition_map.cpp channels.cpp 

test_tinyxml:

test_rate:
	@echo "compiling & linking..."
	$(CC) $(CFLAGS) -o ../test_rate $(SRC) test_rate.cpp -lgsl -lm -lgslcblas $(INCLS)

test_channels:
	@echo "compiling & linking..."
	$(CC) $(CFLAGS) -o ../test_channels rate.cpp channels.cpp test_channels.cpp -lgsl -lm -lgslcblas $(INCLS)

test_hamilton:
	@echo "compiling & linking..."
	$(CC) $(CFLAGS) -o ../test_hamilton rate.cpp channels.cpp hamilton.cpp test_hamilton.cpp -lgsl -lm -lgslcblas $(INCLS)

test_initial_state:
	@echo "compiling & linking..."
	$(CC) $(CFLAGS) -o ../test_initial_state rate.cpp channels.cpp hamilton.cpp initial_state.cpp test_initial_state.cpp -lgsl -lm -lgslcblas $(INCLS)

test_transition_map:
	@echo "compiling & linking..."
	$(CC) $(CFLAGS) -o ../test_transition_map transition_map.cpp test_transition_map.cpp -lgsl -lm -lgslcblas $(INCLS)

test_nmqj_alg:
	@echo "compiling & linking..."
	$(CC) $(CFLAGS) -o ../test_nmqj_alg $(SRC) test_nmqj_alg.cpp -lgsl -lm -lgslcblas $(INCLS)


$(OBJS):dtcl4.cpp effective_ensemble.cpp channels.cpp algorithm.cpp output.cpp input.cpp random.cpp jumppaths.cpp rate.cpp channels.cpp
	$(CC) $(CFLAGS) $(INCLS) -c  $*.cpp

$(OTLA):TLA.cpp
	$(CC) $(CFLAGS) $(INCLS) -c $*.cpp

$(OLAMBDA):Lambda.cpp
	$(CC) $(CFLAGS) $(INCLS) -c $*.cpp

$(OLADDER):Ladder.cpp
	$(CC) $(CFLAGS) $(INCLS) -c $*.cpp

$(Onmqj):NMQJ.cpp
	$(CC) $(CFLAGS) $(INCLS) -c $*.cpp


clean:
	rm -f $(OBJS) $(OLAMBDA) $(OTLA) $(OLADDER) $(Onmqj)